package com.itheima.Demo;

import java.util.*;
import java.util.stream.Stream;

public class Demo流的获取 {
    public static void main(String[] args) {
        //list获取流对象;
        ArrayList<String > list = new ArrayList<>();
        //获取;流的方法stream;
        Stream<String> stream = list.stream();
        //set获取流对象;
        HashSet<String> set = new HashSet<>();
        Stream<String> stream1 = set.stream();
        //数组获取流对象;
        //数组获取流对象必须是引用类型的数组;
        Integer [] array  = {11,22,33,44};
        Stream<Integer> array1 = Stream.of(array);
        //map获取流对象方式;
        //map获取流对象需要先把键值对转换成两个单列集合;
        HashMap<String,Integer> map =new HashMap<>();
        //把键转换成单列集合;
        Set<String> keySet = map.keySet();
        Stream<String> stream2 = keySet.stream();
        //再把值转换成单列集合;
        Collection<Integer> values = map.values();
        Stream<Integer> stream3 = values.stream();
    }
}
